package org.jeecg.modules.dock.service.impl;

import cn.hutool.core.util.IdUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.dock.constant.SystemConstants;
import org.jeecg.modules.dock.controller.EmsDockingController;
import org.jeecg.modules.dock.entity.DockDataReceiveRecord;
import org.jeecg.modules.dock.entity.DockTaskRecordMap;
import org.jeecg.modules.dock.entity.dto.request.BaseRequestDTO;
import org.jeecg.modules.dock.entity.dto.request.CoilStockDetail;
import org.jeecg.modules.dock.entity.ems.request.CuttingPaperReturnTubeRequestVO;
import org.jeecg.modules.dock.entity.ems.request.ForceCompleteReuqestVO;
import org.jeecg.modules.dock.enums.EmsBucketStatusEnum;
import org.jeecg.modules.dock.enums.MesInterfaceTypeEnum;
import org.jeecg.modules.dock.handler.StatusFactory;
import org.jeecg.modules.dock.handler.StatusHandler;
import org.jeecg.modules.dock.mapper.DockDataReceiveRecordMapper;
import org.jeecg.modules.dock.mapper.DockTaskRecordMapMapper;
import org.jeecg.modules.dock.service.EmsDockingService;
import org.jeecg.modules.flow.sys.service.WorkFlowService;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * ems对接数据服务
 *
 * @author zhoutong
 */
@Service
@Slf4j
@AllArgsConstructor
public class EmsDockingServiceImpl implements EmsDockingService {

    private final DockDataReceiveRecordMapper dockDataReceiveRecordMapper;

    private final DockTaskRecordMapMapper dockTaskRecordMapMapper;

    private final WorkFlowService workFlowService;

    @Override
    public void putBucketDetail(BaseRequestDTO<CoilStockDetail> param) {
        log.info("putBucketDetail---WMS实时接收到的数据是:{} ", param);
    }

    @Override
    public void serviceInteraction(EmsDockingController.TaskTypeUpdateParam param) {
        log.info("serviceInteraction----WMS实时接收到的数据是:{} ", param);
        StatusHandler handler = StatusFactory.createHandler(SystemConstants.EMS);
        handler.handle(param);

    }

    @Override
    public void cuttingPaperReturnTube(CuttingPaperReturnTubeRequestVO vo) {
        log.info("WMS实时接收到的数据是:{} ", vo);
    }

    @Override
    public void forceComplete(ForceCompleteReuqestVO vo) {
        log.info("WMS实时接收到的数据是:{} ", vo);
    }

//    private DockDataReceiveRecord getRecord(String data) {
//        DockDataReceiveRecord dockDataReceiveRecord = new DockDataReceiveRecord();
//        dockDataReceiveRecord.setUuid(IdUtil.fastSimpleUUID());
//        dockDataReceiveRecord.setSource(SystemConstants.EMS);
//        dockDataReceiveRecord.setTarget(SystemConstants.WMS);
////        dockDataReceiveRecord.setBusinessCode(business);
//        return dockDataReceiveRecord;
//    }
}
